import { defineConfig } from 'tsdown'
import Vue from 'unplugin-vue/rolldown'
import sass from 'rollup-plugin-sass'

export default defineConfig({
  entry: {
    // 主入口
    index: './src/index.ts',
    // 分入口
    components: './src/components/index.ts',
    wallets: './src/wallets/walletConnectors/index.ts',
    plugin: './src/plugin.ts'
  },
  platform: 'neutral',
  minify: false,
  skipNodeModulesBundle: true,
  external: ['qrcode'],
  outputOptions: {
    //打包格式
    cssChunkFileNames: 'style.css',
    // 保持 assets 独立输出
    assetFileNames: '_assets/[name]-[hash].[ext]',
    chunkFileNames: '_assets/[name]-[hash].js',
    entryFileNames: '[name].mjs',
  },
  plugins: [
    Vue({ isProduction: false }),
    sass({
      exclude: 'node_modules/**',
      include: ['**/*.css', '**/*.sass', '**/*.scss'],
      output: 'dist/style.css',
      api: 'modern'
    }),
  ],
  dts: { vue: true },
})
